package com.jemmyee.core.web.controller;

import java.io.File;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description: TODO
 * @author:jemmyee@gmail.com
 * @date:2010-11-8
 * @version:v1.0
 */
public class BaseController{
	

	/**
	* @Description:返回系统的根网址 eg:http://localhost:8080/linzhen
	* @author:jemmyee@gmail.com
	* @date:2010-11-8
	*/
	public String getWebURL(HttpServletRequest request){
		String app = request.getContextPath();//项目名称 eg:linzhen
		String webRoot = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+app+"/";
		return webRoot;
		
	}
    

	/**
	* @Description: 得到项目绝对地址 eg:E:\tomcat-6.0.20\webapps\linzhen\
	* @author:jemmyee@gmail.com
	* @date:2010-11-8
	*/
	public String getAppRoot(HttpServletRequest request) {
		return request.getSession().getServletContext().getRealPath(File.separator);
	}


}
